<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../../_template.xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:define name="centro">
        <h:form>
            <p:outputLabel value="Cadastro de Nota Fiscal - Alterar Lançamento" style="font-size: x-large" styleClass="labelAlterar" />
            <p:fieldset styleClass="fieldsetInsert">
                <p:messages />
                <h:panelGrid columns="4" >
                    <h:panelGrid columns="1">
                        <p:outputLabel style="margin: 5px; text-align: left" for="nr" value="Número" />
                        <p:inputText id="nr"  value="#{notaFiscalBean.lancamento.sequencial}" disabled="true" style="width: 60px"/>
                    </h:panelGrid>

                    <h:panelGrid columns="1" style=" margin-left: 10px;">
                        <h:outputLabel style="margin: 5px;text-align: left;" for="da" value="Data do Pagamento" />
                        <p:calendar id="da" pattern="dd/MM/yyyy" yearRange="c-100:c+100" navigator="true" readonlyInput="true"
                                    value="#{notaFiscalBean.lancamento.dataPagamento}" disabled="true"
                                    required="true" requiredMessage="Informe a data de pagamento." />
                    </h:panelGrid>

                    <h:panelGrid columns="1" style=" margin-left: 10px;">
                        <h:outputLabel style="margin: 5px; text-align: left;" value="Valor" for="valor" />                  
                        <p:inputText style="width: 200px; text-align: right" id="valor" value="#{notaFiscalBean.lancamento.valor}" styleClass="moeda" 
                                     required="true" requiredMessage="Informe o valor do lançamento." disabled="true">
                            <f:convertNumber minFractionDigits="2" maxFractionDigits="2" locale="pt_BR" />
                        </p:inputText>
                    </h:panelGrid>
                    
                    <h:panelGrid columns="1" >
                        <p:outputLabel style="margin-left: 10px; text-align: left" value="Situação" />
                        <p:selectOneMenu value="#{notaFiscalBean.lancamento.situacao}" style="margin-left: 10px"
                                         required="true" requiredMessage="Selecione a situação." >
                            <f:selectItem itemLabel="selecione" noSelectionOption="true"/>
                            <f:selectItem itemLabel="A VENCER"   itemValue="A VENCER"  />
                            <f:selectItem itemLabel="PAGO" itemValue="PAGO"/>
                        </p:selectOneMenu>
                    </h:panelGrid>
                </h:panelGrid><br />
                
                <p:commandButton value="Alterar Lançamento" action="#{notaFiscalBean.alterarLancamento}" icon="ui-icon-check" >
                    <p:confirm header="Confirmação" message="Deseja alterar a informação?" icon="ui-icon-alert" />
                    <p:confirmDialog global="true"  showEffect="fade" >
                        <p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                        <p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                    </p:confirmDialog>
                </p:commandButton>
               
                <p:commandButton value="Voltar" action="incluirNotaFiscal" immediate="true" ajax="false" icon="ui-icon-arrowreturnthick-1-w"
                                 style="margin-left: 10px;"/>   
            </p:fieldset>
        </h:form>  
    </ui:define>

</ui:composition>
